function FilterRoutes(text, list) {
    let arr = list.filter(item => {
        // 一级筛选
        return item.auth.includes(text)
    })

    // 递归筛选
    arr.length && arr.forEach(item => {
        // 筛选完成过去对当前children进行赋值
        if (item.children) {
            item.children = FilterRoutes(text, item.children)
        } 
    })
    return arr
}

export {
    FilterRoutes
}